<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>新增报名信息</title>
<link rel="stylesheet" href="../../css/ecp.min.css" />
<link rel="stylesheet" href="../../css/picUpload.css" />
<script src="../../js/lib.min.js"></script>
<script src="../../js/requirejsConfigObj.js"></script>
<script src="../../js/requirejs/2.1.17.js"></script>
<script src="../../js/common.min.js"></script>

<style  type="text/css">
    .check_error{color:red;border-color:red;}
    .width130{width:460px;height: 25px;}
	.btn_stl{    padding: 4px 8px;
    font-size: 12px;
    margin: 0;
    margin-right: 5px;
    border-radius: 3px;}
  
</style>    
</head>
<body> 
  <div id="showMsg" class="project"></div> 
  <div class="project-dialog"> 
   <form id="formItem" name="formItem" style="width: 100%;"> 
     <div>
     	<input type="hidden" id="approvalFlagHide" value=""/> 
      <table class="form_table" width="95%"> 
       <tbody id="table_tbody">
       <tr>
            <td width="130">
                 <label class="description"> <span class="fn-high">*</span>姓名</label>
            </td>
            <td width="260" colspan="3">
                <input type="text" class="inputWidth width130" maxlength="200" name="userNm" id="userNm"/>                   
            </td>            
       </tr>
       <tr>
            <td>
                 <label class="description"> <span class="fn-high">*</span>地址</label>
            </td>
            <td colspan="3">
                <input type="text" class="inputWidth width130" maxlength="200" name="enrollAddr" id="enrollAddr"/>   
            </td>
        </tr> 
        <tr>
            <td>
                 <label class="description"> <span class="fn-high">*</span>电话</label>
            </td>
            <td colspan="3">
                <input type="text" class="inputWidth width130" maxlength="200" name="userTelnum" id="userTelnum"/>   
            </td>
        </tr>  
        <tr>
            <td>
                 <label class="description"> QQ</label>
            </td>
            <td colspan="3">
                <input type="text" class="inputWidth width130" maxlength="200" name="userQQ" id="userQQ"/>   
            </td>
        </tr>  
        <tr>
            <td>
                 <label class="description"> 微信</label>
            </td>
            <td colspan="3">
                <input type="text" class="inputWidth width130" maxlength="200" name="userWeixin" id="userWeixin"/>   
            </td>
        </tr> 
        <tr>
            <td>
                 <label class="description"> 推荐人</label>
            </td>
            <td colspan="3">
                <input type="text" class="inputWidth width130" maxlength="200" name="introducerPsn" id="introducerPsn"/>   
            </td>
        </tr> 
        <tr>
            <td>
                 <label class="description"> 推荐人电话</label>
            </td>
            <td colspan="3">
                <input type="text" class="inputWidth width130" maxlength="200" name="introducerTelnum" id="introducerTelnum"/>   
            </td>
        </tr> 
        <tr>
            <td>
                 <label class="description"> 想要参加的会议</label>
            </td>
            <td colspan="3">
            	<input type="text" class="inputWidth width130" readonly="readonly" name="meetNm" id="meetNm"/> 
                <input type="hidden" class="inputWidth width130" maxlength="200" name="enrollTypeCd" id="enrollTypeCd" value="1001"/>
                <input type="hidden" class="inputWidth width130" maxlength="200" name="meetId" id="meetId" value="b552effb-9f86-4bbf-bf8f-f0c33209384f"/>   
            	<a class="BGblue btn_stl" href="javascript:;" id="" onclick="checkMeetWin()">选择</a> 
            </td>
        </tr>       
        <tr>
           <td>
               <label class="description">需求描述</label>
           </td>
           <td colspan="3">
               <textarea type="text" name="enrollDesc" id="enrollDesc" class="form-textarea"  placeholder="请输入500字以内" style="width: 700px;height: 130px;resize:none ;" onblur="true" maxlength="500"></textarea>
           </td>
       </tr>          
       </tbody> 
      </table> 
      <hr />
     <div class="formBtnArea"> 
      <table width="100%"> 
       <tbody>
        <tr> 
         <td> 
          <div class="normalBtnArea fn-center"> 
           <input type="hidden" id="hideDataRoute" name="hideDataRoute" value=""/>
           <a class="normalBtn BGblue largeBtn" href="javascript:;" onclick="save()">保存</a> 
           <a href="javascript:;" class="BGblue largeBtn" id="J_cancel" onclick="cancleConfirm()"><span>返回</span></a> 
          </div> 
          </td> 
        </tr> 
       </tbody>
      </table> 
     </div> 
    </div> 
   </form> 
  </div>
  <div class="fn-hide" id="checkMeetListWin">
  	<div class="cmxform">
		<form class="record-search-form record-search-min record-search-form-border" id="J_MeetFormSearch" name="J_MeetFormSearch">
			<div class="record-search-cate">
				<table class="search_table" cellpadding="0" cellspacing="0" border="0" width="100%">
				 <tr class='hide_row'>
				    <td width="80">
                       <label class="description">姓名</label>
                    </td>
                    <td width="200">
                        <input type="text" name="meetNm" id="meetNm"/>
                    </td>
                    <td class="td-last-child">
                    	<a class="searchBtn" href="javascript:;" id="J_MeetSearch"><i></i>查询</a>
               		</td>
				 </tr>
			</table>
			</div>
		</form>
	</div>
  	<div class="tablewidth mg_t_10" id="titleReport">
	 <table class="ui-record-table table_radius tab-border table-striped mg_t_42" width="100%">
        <thead id ="">   
        <tr>
            <th width="35">选择</th>
            <th width="120">标题</th>
            <th width="100">类型</th>
            <th width="120">时间</th>
            <th width="120">地点</th> 
            <th width="120">人数</th>                        
          </tr>       
        </thead>
        <tbody id="J_MeetTabletpl"></tbody>
        </table>  	
      </div>
      <!--翻页及功能按钮区域开始-->
      <DIV class="amount-bottom" >
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="gridBottom">
          <tr>
			<td class="ta_l">
             </td>
            <td width="50%">
                <DIV class="fn-clear action-other  action-other-show ">
                        <DIV id="paginationMeet" class="page pagination fn-right"></DIV>
                        <DIV class="fn-right fn-pt5 fn-pr10"></DIV>
                </DIV></td>
          </tr>
        </table>
    </DIV>
    <div class="normalBtnArea fn-center"> 
           <a class="normalBtn BGblue largeBtn" href="javascript:;" id="save_meet" onclick="save_meet();">确定</a> 
           <a href="javascript:;" class="BGblue largeBtn" onclick="cancle_meet();"><span>取消</span></a> 
    </div> 
  </div>
 </body>
 <script id="T_MeetTabletpl" type="text/x-handlebars-template">
	{{#if beans}}
	  {{#each beans}}
        <tr>
            <td width="25" align="center"><input type="checkbox" attr_meetTypeCd="{{meetTypeCd}}" attr_meetNm="{{meetNm}}" attr_meetId="{{meetId}}" value="{{meetId}}"/></td>
			<td width="100">{{meetNm}}</td>
            <td width="100">{{meetTypeCd}}</td>
            <td width="100">{{meetTime}}</td>
			<td width="100">{{meetAddr}}</td>
			<td width="100">{{mettPeopleNum}}</td>
        </tr>		
	  {{/each}}	
	{{else}}
	<tr>
		<td colspan="6">
			<div class="ui-tips-box a">
				<div class="ui-icon-noData"></div>
				<div class="ui-tips-text">暂无数据记录！</div>
			</div>
		</td>
	</tr>
    {{/if}}
	</script>

<script type="text/javascript">

$(function(){
	
});
function  qryOpAndRaVal(){
    var str = "5000$5023";
    var param={queryType:str};
    Util.ajax.postJsonSync("/home", param, function(json,status){
    	
              alert(json.aaaa);           
    });
}
function save(){  
	var userNm = $("#userNm").val();
	var enrollAddr = $("#enrollAddr").val();
	var userTelnum = $("#userTelnum").val();
	var introducerPsn = $("#introducerPsn").val();
	var userQQ = $("#userQQ").val();
	var userWeixin = $("#userWeixin").val();
	var meetId = $("#meetId").val();
	var enrollTypeCd = $("#enrollTypeCd").val();
	var introducerTelnum = $("#introducerTelnum").val();
	var enrollDesc = $("#enrollDesc").val();
	if(isDataNull(userNm)){
	   	 top.Util.dialog.tips('请填写姓名！');
	   	 return;
   	} 
	if(isDataNull(enrollAddr)){
	   	 top.Util.dialog.tips('请填写地址！');
	   	 return;
	}
   	if(isDataNull(userTelnum)){
    	 top.Util.dialog.tips('请填写电话！');
    	 return;
    }   
	var param={
   		 'userNm' :userNm,
   		 'enrollAddr' :enrollAddr,
   	     'userTelnum':userTelnum,
   	     'introducerPsn':introducerPsn,
   	     'userQQ':userQQ,
   	     'userWeixin':userWeixin,
   	     'meetId':meetId,
   	     'enrollTypeCd':enrollTypeCd,
   	     'enrollDesc':enrollDesc,
   	     'introducerTelnum':introducerTelnum
   	     
    }   
   Util.ajax.postJsonSync("/addEnrollInfo",param,function(json,status){
          if(status){
       	   if(json.bean.rtnCd == "00"){       		   
                  window.parent.inint();
                  window.parent.closeIframeDialog();                 
              }else{              
                  window.parent.setTip("保存失败",top,2000);
              }
          }else{
              var rtnMsg = json.bean.rtnMsg ? json.bean.rtnMsg : "";
              Util.dialog.tips("保存失败,请重试!!"+rtnMsg);
              //showDialogMsg("保存失败,请重试 !!</br>"+rtnMsg);
          }
    }); 
}
	//取消确认弹框
	function cancleConfirm(){
		//window.location.href = "newProjEstabMana.html?";
		window.parent.closeIframeDialog();
	};
	
    function isDataNull(str) {
        if (str == null || str == "" || str == undefined || str == '[]') {
            return true;
        }
        return false;
    }
	
  
    //表单校验
    var validatePoorHouseInfo = $("#formItem").validate({
    	rules:{
    		userNm:{
        		required:true,
        	},
        	userTelnum:{
        		required:true,
        	},
        	enrollAddr:{
        		required:true,
            }
        },
        messages:{
        	userNm:{
        		required:"必填",
            },
            userTelnum:{
            	required:"必填",
            },
            enrollAddr:{
            	required:"必填",
            }
        },
        showErrors:function(){
            this.defaultShowErrors();
        }
    });
    jQuery.validator.addMethod("checkNumber",function(value,element) { 
        var regUrl = /^[1-9]\d{0,14}$/;// /^\d{0,15}$/;
        return this.optional(element) || regUrl.test(value);
    }, "请输入正整数");
    
    jQuery.validator.addMethod("checkLittleNumber",function(value,element) { 
    	var regUrl = /^\d{0,10}(\.\d{1,4})?$/;
        return this.optional(element) || regUrl.test(value);
    }, "保留4位小数");
    
    function checkNumberDecimals(num){
    	var regx = /^\d{0,20}(\.\d{1,2})?$/;
    	if(regx.test(num)){
    		return true;
    	}else{
    		return false;
    	}
    }
  	//账号校验  请正确填写银行账号
    function checkAcctNum(num){
    	var regUrl = /^\+?[1-9][0-9]*$/;
   	  	if(regUrl.test(num) && num.length >= 14 && num.length <= 19){
   		  	return true;
   	  	}else{
   		  	return false;
   	  	}
    }
    function checkTotalInvest(num){
    	var regx = /^\d{0,7}(\.\d{1,4})?$/;
    	if(regx.test(num)){
    		return true;
    	}else{
    		return false;
    	}
    }
    function checkTotalNum(num){
    	var regx = /^\d+$/;
    	if(regx.test(num)){
    		return true;
    	}else{
    		return false;
    	}
    } 
    var G_paramsMeetList = {
			url : '/getMeetLIst',
			items_per_page : 10,   		// 每页数     @param : limit
			page_index : 0 , 
			pagination: "paginationMeet", //分页id
			searchformId : "J_MeetFormSearch", //搜索表单的id
			tabletpl : "T_MeetTabletpl", //表格模板
			tablewrap : "J_MeetTabletpl" //表格容器
		};
    var checkMeetListW = document.getElementById('checkMeetListWin');
    var _dialogUnit = null;
    var showDialogCompanyDtl = function() {
        var paramsCompanyDtl = {
          id: 'D_meetList_dtl', //弹出对话框的id
          title: '会议列表', //左上角提示标题
          content: checkMeetListW, //具体提示内容
          width: '900', //对话框宽度
          height: '400', //对话框高度
          modal: true
        };
        _dialogUnit = Util.dialog.openDiv(paramsCompanyDtl);
   };
    //选择会议列表
 function checkMeetWin(){
	 showDialogCompanyDtl();
	 initMeet();
 }
  $("#J_MeetSearch").on('click',function(){
	  initMeet();
  })
  function initMeet(){
	  var str = $("#" + G_paramsMeetList.searchformId).serialize(); //把form序列化
	  Util.pagination(0, true,G_paramsMeetList, str);
  }
  function save_meet(){
		var meetId = $('#J_MeetTabletpl input[type="checkbox"]:checked').val();
	 	var meetTypeCd = $('#J_MeetTabletpl input[type="checkbox"]:checked').attr('attr_meetTypeCd');
	 	var meetNm = $('#J_MeetTabletpl input[type="checkbox"]:checked').attr('attr_meetNm');
	 	$("#enrollTypeCd").val(meetTypeCd);
	 	$("#meetId").val(meetId);
	 	$("#meetNm").val(meetNm);
	 	Util.dialog.close("D_meetList_dtl");
 }
 function cancle_meet(){
	 Util.dialog.close("D_meetList_dtl");
 }
</script>
</body>
</html>